Skip to content

Add continuous scrolling for multi-page documents#699

Open
aljazceru wants to merge 1 commit into
GrapheneOS:mainfrom
aljazceru:continuous-scroll-upstream
Open

Add continuous scrolling for multi-page documents#699
aljazceru wants to merge 1 commit into
GrapheneOS:mainfrom
aljazceru:continuous-scroll-upstream

Conversation

@aljazceru

@aljazceru aljazceru commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • render pages in a continuous scrolling container and lazily render the visible window
  • track the most-visible page and keep late-page jumps pending until their wrapper exists
  • coalesce pinch render requests so large documents remain responsive
  • add fit-mode and continuous-scrolling controls

Why

Large documents exposed two races in the continuous renderer. Repeated pinch events could queue enough WebView/JavaScript work to delay state reads, and a late-page jump could run before progressive page setup created the target wrapper. The scroll handler could then overwrite the requested page.

Zoom rendering now keeps one request in flight and coalesces pending updates. Page requests remain sticky until the target is laid out. Rendering and relayout are limited to the visible page window.

Validation

  • npm test -- --reporter=dot — 14 tests passed
  • npx eslint .
  • ./gradlew :app:lintDebug :app:assembleDebug :app:assembleDebugAndroidTest --no-daemon
  • ANDROID_SERIAL=5A011JEBF06589 ./gradlew connectedDebugAndroidTest --no-daemon — 77 tests passed on a Pixel 9a
  • git diff --check

@aljazceru aljazceru force-pushed the continuous-scroll-upstream branch from 7798537 to e38cae2 Compare July 15, 2026 11:53
@aljazceru aljazceru marked this pull request as ready for review July 15, 2026 15:54
@rdevshp

rdevshp commented Jul 15, 2026

Copy link
Copy Markdown

I tested your PR using app/src/androidTest/assets/test-multipage.pdf . There are panning issues when zoomed in when the viewer is at page 4 of the test pdf file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants